<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
	<head>
		<title>添加选校管理</title>
		<link rel="stylesheet" href="${ctx }/scripts/plugins/tab/ui.tabs.css" type="text/css" media="print, projection, screen">
		<script src="${ctx }/scripts/plugins/tab/ui.core.js" type="text/javascript"></script>
        <script src="${ctx }/scripts/plugins/tab/ui.tabs.js" type="text/javascript"></script>
		<link rel="stylesheet" type="text/css" href="${ctx }/styles/displaytag.css" />
		<script type="text/javascript">
			function SetCwinHeight(obj){
				var iframe = obj;
			  	if (document.getElementById){
			   		if (iframe && !window.opera){
			    		if (iframe.contentDocument && iframe.contentDocument.body.offsetHeight){
			    			iframe.height = iframe.contentDocument.body.offsetHeight + 10;
			    		}else if(iframe.Document && iframe.Document.body.scrollHeight){
			    			iframe.height = iframe.Document.body.scrollHeight + 30;
			    		}
			   		}
				}
			}
			
			function addMaterial(){
				art.dialog.open(
					ctx + "/initAddMaterialInfo.html?vipServiceId=${param.vipServiceId}", {
						title: "添加选校",
						width:"500px", 
						height:"665px",
						lock: true
					}
				);
			}

			function showMaterail(sid){
				art.dialog.open(
					ctx + "/getMaterailBySid.html?id=" + sid, {
						title: "申请要求",
						width:"500px", 
						height:"320px",
						lock: true
					}
				);
			}

			function deleteMaterial(id){
				var url = ctx + "/deleteMaterialInfo.html?ajax=true";
				var param = "&id=" + id;
				var sf = function (msg) {
					if (msg == 1 || msg == "1" || msg == "\"1\"") {
						art.dialog.tips("<label class='success'>删除成功！</label>", 1);
						window.location.reload();
						return true;
					}else{
						art.dialog.tips("<label class='error'>删除失败，请刷新页面重试！</label>", 1);
						return false;
					}
				};
				ajax(url, param, sf);
			};
			
			function deleteItem(id){
				art.dialog({
				    content: '您确定要删除该条选校记录吗？',
				    ok: function () {
				        return deleteMaterial(id);
				    },
				    cancel: true,
					lock: true
				});
			}
			
			function editMaterial(id){
				art.dialog.open(
					ctx + "/initEditMaterialInfo.html?id=" + id, {
						title: "修改申请要求",
						width:"500px", 
						height:"500px",
						lock: true
					}
				);
			}
			
			$(function() {
                $('#rotate > ul').tabs({ fx: { opacity: 'toggle' } });
            });
		</script>
	</head>
	<body>
		<div class="container_16">
			<div class="grid_16">
				<div class="content_top">
					<span>添加选校管理</span>
					<a href="${ctx }/initVipServiceInfo.html?id=${param.vipServiceId }" style="float: right;padding: 6px;"><input type="button" class="button" value="返回VIP专案主页"></a>
				</div>
				<div class="content_bottom">
					<div style="padding: 30px;">
						<table cellpadding="0" cellspacing="0" class="service_table">
							<tr>
								<th class="left">
									VIP服务专案号：${vipService.vipServiceId }
								</th>
								<th class="right">
									服务时间：<fmt:formatDate value="${vipService.startTime }" pattern="yyyy-MM-dd"/>&nbsp;&nbsp;至&nbsp;&nbsp;<fmt:formatDate value="${vipService.endTime }" pattern="yyyy-MM-dd"/>
								</th>
							</tr>
							<tr>
								<td colspan="2">
									<iframe id="userInfoIframe" name="userInfoIframe" onload="Javascript:SetCwinHeight(this)" src="${ctx }/doshowInfo.html?vipServiceId=${param.vipServiceId }" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
								</td>
							</tr>
						</table>
						<c:if test="${'ROLE_USER' ne currentRole.name }">
							<a title="添加选校" href="javascript:void(0)" onclick="addMaterial()"><img src="${ctx}/images/add_school.jpg" alt="添加选校"></a>
						</c:if>	
						<display:table id="sc" name="pageBean" pagesize="10" class="display_table" requestURI="" style="border-collapse: collapse;border-spacing: 0;">
							<display:column title="序号" value="${(pageBean.pageNumber - 1) * pageBean.objectsPerPage + sc_rowNum }" style="width: 5%"/>
						 	<display:column title="学校名称" property="material.school.name" style="width: 30%"/> 	
						 	<display:column title="申请学位" style="width: 10%">
						 		 <fmt:message key="apply.degree.${sc.material.applyDegree }"></fmt:message> 
						 	</display:column>
						 	<display:column title="申请专业" property="material.applyMajor.name" style="width: ${'ROLE_USER' ne currentRole.name ? '25' : '30'}%"/>
						    <display:column title="申请截至日期" property="applyEndTime" format="{0,date,yyyy-MM-dd}" style="width: ${'ROLE_USER' ne currentRole.name ? '10' : '15'}%"/>  
						    <display:column title="申请要求"  style="width: 10%">
						   	 	<a href="javascript:void(0)" onclick="showMaterail(${sc.id})">查看详情</a>
						    </display:column>  	
							<c:if test="${'ROLE_USER' ne currentRole.name }">
							 	<display:column title="操作" style="width: 10%">
						 			<a href="javascript:void(0)" onclick="editMaterial(${sc.id})" >编辑</a>
						 			<a href="javascript:void(0)" onclick="deleteItem(${sc.material.id})">删除</a>
							 	</display:column>
					 		</c:if>	
						</display:table>
						<div id="rotate">
							<ul>
								<li>
									<a href="#comment">
										<span>留言交互</span>
									</a>
								</li>
							</ul>
							<div id="comment">
								<div style="float: right;">
									请下载 <a href="http://www.cloudapply.com/files/信息收集表/选校咨询信息表.doc">选校信息收集表.doc</a>，认真填写后上传。
								</div>
								<iframe id="commentIframe" name="commentIframe" onload="Javascript:SetCwinHeight(this)" src="${ctx }/commentList.html?ownerId=${vipService.id}&ownerType=2" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
							</div>
						</div>
					</div>
				</div>
			</div>			
		</div>
	</body>
</html>		